﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace SmoLiteApi
{
    /// <summary/>
    public class ForeignKeyCollection : IEnumerable<ForeignKey>
    {
        private List<ForeignKey> _foreignKeys;

        /// <summary/>
        internal ForeignKeyCollection()
        {
            this._foreignKeys = new List<ForeignKey>();
        }

        /// <summary/>
        public void Add(ForeignKey foreignKey)
        {
            this._foreignKeys.Add(foreignKey);
        }

        /// <summary/>
        public ForeignKey this[string name]
        {
            get { return this._foreignKeys.Find(value => value.Name == name); }
        }

        /// <summary/>
        public IEnumerator<ForeignKey> GetEnumerator()
        {
            return this._foreignKeys.GetEnumerator();
        }

        /// <summary/>
        IEnumerator IEnumerable.GetEnumerator()
        {
            return this._foreignKeys.GetEnumerator();
        }
    }
}
